/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.login.plugin.register.rapid;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.qihoo.gamecenter.sdk.login.plugin.f.a;
import com.qihoo.gamecenter.sdk.login.plugin.register.a.b;

public class RegisterTabView extends LinearLayout {
    private Activity a;
    private a[] b;
    private LinearLayout c;
    private FrameLayout d;
    private LinearLayout.LayoutParams e;
    private TextView[] f;
    private int g;
    private a h;
    private String i;
    private View.OnClickListener j = new View.OnClickListener() {
        public void onClick(View paramView) {
            int i = ((Integer) paramView.getTag()).intValue();
            RegisterTabView.this.a(i, false);
        }
    };

    public RegisterTabView(Context paramContext, String paramString) {
        super(paramContext);
        this.a = ((Activity) paramContext);
        this.i = paramString;
        this.e = new LinearLayout.LayoutParams(-1, -1);
        this.h = a.a(this.a);
        a();
    }

    private void a() {
        setOrientation(1);
        this.c = new LinearLayout(this.a);
        this.d = new FrameLayout(this.a);
        LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, 0);
        localLayoutParams.weight = 1.0F;
        addView(this.d, localLayoutParams);
    }

    public void setTabs(a[] paramArrayOfa, int paramInt) {
        if ((paramArrayOfa == null) || (paramArrayOfa.length <= 0))
            return;
        int k = paramArrayOfa.length;
        this.b = new a[k];
        this.f = new TextView[k];
        System.arraycopy(paramArrayOfa, 0, this.b, 0, k);
        paramInt = ((paramInt < 0) || (paramInt >= k)) ? 0 : paramInt;
        LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(0, -1);
        localLayoutParams.weight = (1.0F / k);
        localLayoutParams.gravity = 16;
        int l = 0;
        for (a locala : this.b) {
            TextView localTextView = new TextView(this.a);
            this.f[l] = localTextView;
            ++l;
        }
        a(paramInt, true);
    }

    public void a(int paramInt, boolean paramBoolean) {
        if ((this.g == paramInt) && (!(paramBoolean)))
            return;
        this.d.removeAllViews();
        this.f[this.g].setTextColor(Color.parseColor("#979797"));
        this.f[paramInt].setTextColor(Color.parseColor("#32a124"));
        this.h.a(this.f[this.g], this.b[this.g].c[0]);
        this.h.a(this.f[paramInt], this.b[paramInt].c[1]);
        this.d.addView(this.b[paramInt].b.a(), this.e);
        this.b[this.g].b.b();
        this.b[paramInt].b.c();
        this.g = paramInt;
    }

    public class a {
        public String a;
        public b b;
        public int[] c = { 0, 0 };
    }
}